/*
 * 文 件 名 : HomeActivity.java
 * 版    权 : China Machi.Co.,Ltd.Copyright 2009-2011.All rights reserved
 * 描    述 : <描述>
 * 修 改 人 : lixg
 * 修改时间 : 2012-8-4
 * 跟踪单号 : <跟踪单号>
 * 修改单号 : <修改单号>
 * 修改内容 : <修改内容>
 */
package com.fire8.dolphin.ui.more;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.fire8.dolphin.ui.DolphinApplication;
import com.fire8.dolphin.ui.R;
import com.fire8.dolphin.utils.StringUtil;
import com.fire8.dolphin.web.RequestUtils;

/**
 * 反馈意见界面
 * 
 *
 * @author  lixg
 * @version [版本号,2012-8-4]
 * @see     [相关类/方法]
 * @since   [产品/模块]
 */
public class SuggestionActivity extends Activity
{
    private final String TAG="dolphin";
    
    private EditText txtTitle;
    private EditText txtContext;
    private Button btnEnter;
    
    private String strTitle;
    private String strContext;
    DolphinApplication app;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.question_add);
        txtTitle = (EditText)findViewById(R.id.txt_title);
        txtContext = (EditText)findViewById(R.id.txt_context);
        btnEnter = (Button)findViewById(R.id.btn_enter);
        btnEnter.setOnClickListener(new ButtonClickLienter());
        app = (DolphinApplication)getApplication();
    }
    @Override
    protected void onStart()
    {
        super.onStart();
        txtTitle.setHint("请输入你的联系方式[QQ或手机号码或email]");
        txtContext.setHint("请输入你的宝贵意见");
        txtContext.requestFocus();
    }
    class ButtonClickLienter implements OnClickListener
    {

        @Override
        public void onClick(View v)
        {
            Log.i(TAG,"点击确定");
            //Toast.makeText(QuestionAddActivity.this, "点击确定", Toast.LENGTH_LONG).show();
            strTitle = txtTitle.getText().toString();
            strContext = txtContext.getText().toString();
            if(StringUtil.isEmpty(strContext))
            {
                //Toast.makeText(SuggestionActivity.this, "请输入问题内容", Toast.LENGTH_LONG).show();
                return;
            }
            //上传问题
            List<NameValuePair> param = new ArrayList<NameValuePair>();
            param.add(new BasicNameValuePair("title",strTitle));
            param.add(new BasicNameValuePair("context",strContext));
            RequestUtils.getInstall().getHttpJson(DolphinApplication.URL+"comm/addSuggestion.php", param);
            Toast.makeText(SuggestionActivity.this, "谢谢您的宝贵意见！", Toast.LENGTH_LONG).show();
            SuggestionActivity.this.finish();//关闭窗口
        }
        
    }
    
}
